package ajaxTestSuite;

import com.thoughtworks.selenium.SeleneseTestCase;

public class ComboBox extends SeleneseTestCase {
	@Override
	public void setUp() throws Exception {
		setUp("http://www.asp.net/", "*firefox");
		selenium.setSpeed("1000");
	}

	public void testComboBox() throws Exception {
		selenium.open("/ajax/ajaxcontroltoolkit/Samples/Default.aspx");
		selenium.waitForPageToLoad("30000");
		selenium.click("id=ctl00_SamplesLinks_ctl10_SamplesLink");
		selenium.waitForPageToLoad("30000");
		selenium.type("id=ctl00_SampleContent_ComboBox1_TextBox", "X-ray");
		// checking AutoPostBackCheckBox pick|unpick
		selenium.click("id=ctl00_SampleContent_AutoPostBackCheckBox");
		assertEquals(selenium.getText("id=ctl00_SampleContent_AutoPostBackSourceLabel"),"True");		
		selenium.click("id=ctl00_SampleContent_AutoPostBackCheckBox");
		assertEquals(selenium.getText("id=ctl00_SampleContent_AutoPostBackSourceLabel"),"False");
		
		selenium.click("id=ctl00_SampleContent_DropDownStyleRadioButtonList_0");
		assertEquals(selenium.getText("id=ctl00_SampleContent_DropDownStyleSourceLabel"),"Simple");
		selenium.click("id=ctl00_SampleContent_DropDownStyleRadioButtonList_1");
		assertEquals(selenium.getText("id=ctl00_SampleContent_DropDownStyleSourceLabel"),"DropDown");
		selenium.click("id=ctl00_SampleContent_DropDownStyleRadioButtonList_2");
		assertEquals(selenium.getText("id=ctl00_SampleContent_DropDownStyleSourceLabel"),"DropDownList");
		
		selenium.click("id=ctl00_SampleContent_AutoCompleteModeRadioButtonList_0");
		assertEquals(selenium.getText("id=ctl00_SampleContent_AutoCompleteModeSourceLabel"),"None");
		selenium.click("id=ctl00_SampleContent_AutoCompleteModeRadioButtonList_1");
		assertEquals(selenium.getText("id=ctl00_SampleContent_AutoCompleteModeSourceLabel"),"Suggest");
		selenium.click("id=ctl00_SampleContent_AutoCompleteModeRadioButtonList_2");
		assertEquals(selenium.getText("id=ctl00_SampleContent_AutoCompleteModeSourceLabel"),"Append");
		selenium.click("id=ctl00_SampleContent_AutoCompleteModeRadioButtonList_3");
		assertEquals(selenium.getText("id=ctl00_SampleContent_AutoCompleteModeSourceLabel"),"SuggestAppend");
		
		selenium.click("id=ctl00_SampleContent_CaseSensitiveCheckBox");
		assertEquals(selenium.getText("id=ctl00_SampleContent_CaseSensitiveSourceLabel"),"True");
		selenium.click("id=ctl00_SampleContent_CaseSensitiveCheckBox");
		assertEquals(selenium.getText("id=ctl00_SampleContent_CaseSensitiveSourceLabel"),"False");
		
		selenium.click("id=ctl00_SampleContent_CssClassRadioButtonList_0");
		selenium.click("id=ctl00_SampleContent_CssClassRadioButtonList_1");
		assertEquals(selenium.getText("id=ctl00_SampleContent_CssClassSourceLabel"),"AjaxToolkitStyle");
		selenium.click("id=ctl00_SampleContent_CssClassRadioButtonList_2");
		assertEquals(selenium.getText("id=ctl00_SampleContent_CssClassSourceLabel"),"AquaStyle");
		selenium.click("id=ctl00_SampleContent_CssClassRadioButtonList_3");
		assertEquals(selenium.getText("id=ctl00_SampleContent_CssClassSourceLabel"),"WindowsStyle");
		
		selenium.click("id=ctl00_SampleContent_ItemInsertLocationRadioButtonList_1");
		assertEquals(selenium.getText("id=ctl00_SampleContent_ItemInsertLocationSourceLabel"),"Prepend");
		selenium.click("id=ctl00_SampleContent_ItemInsertLocationRadioButtonList_2");
		assertEquals(selenium.getText("id=ctl00_SampleContent_ItemInsertLocationSourceLabel"),"OrdinalText");
		selenium.click("id=ctl00_SampleContent_ItemInsertLocationRadioButtonList_3");
		assertEquals(selenium.getText("id=ctl00_SampleContent_ItemInsertLocationSourceLabel"),"OrdinalValue");
		selenium.click("id=ctl00_SampleContent_ItemInsertLocationRadioButtonList_0");
		assertEquals(selenium.getText("id=ctl00_SampleContent_ItemInsertLocationSourceLabel"),"Append");
	}
}